home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
bitstrg.zip
/
INVERTBI.C
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-01
|
479b
|
30 lines
/*
librairie : bitstrg
invertbit -- inversion de l'etat d'un bit
*/
#include "bitstrg.h"
/*
invert state of specified bit
if bit > map size, 0 is returned, else 1 is returned
*/
unsigned invertbit(ptr,bit)
struct SPARRAY * ptr; /* pointer on structure */
unsigned bit; /* bit number */
{
if(ptr->numlbit < bit) {
return(0);
}
/* XOR original with 1 */
(ptr->pntarray)[bit / SIZE] ^= (1 << (bit & (SIZE - 1)));
return(1);
}